package com.os.sys.controller;

import com.os.sys.common.filter.AuthTarget;
import com.os.sys.common.filter.AuthType;
import com.os.sys.common.utility.XJsonInfo;
import com.os.sys.model.T_SYS_Log;
import com.os.sys.repository.LogRepository;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by Administrator on 2016/12/13.
 */

@RestController
@RequestMapping("/api/sys/log")
public class LogController {
    @Resource
    private LogRepository logRepository;

    @AuthTarget(AuthType.NONE)
    @RequestMapping("/save")
    public XJsonInfo save(@RequestBody T_SYS_Log info) {
        logRepository.save(info);
        return new XJsonInfo();
    }

    @AuthTarget(AuthType.NONE)
    @RequestMapping("/getList")
    public XJsonInfo getList(@RequestBody T_SYS_Log info) {
        return new XJsonInfo().setData(logRepository.findAll());
    }

}
